var AppRun = ($rootScope, $state) => {
    $rootScope.$state = $state;
    $rootScope.$on('$stateChangeStart', (event, toState, toParams, fromState, fromParams) => {

        console.log("AppRun");

        $rootScope.company_id  = toParams.company_id ? toParams.company_id : '';
        $rootScope.mainbg      = toState.name == 'loginindex.login' || 'loginindex.findpass';
        $rootScope.title       = toState.name.indexOf('company') != -1 ? toState.data.pageTitle : '赛事管理';
        $rootScope.iAlert      = toState.name.indexOf('chip') != -1 ? true : false;
        $rootScope.minimaliza  = toState.name.indexOf('race') != -1 ? true : false;
        $rootScope.showloading = true;
        $rootScope.showspinner = true;
    });
}

AppRun.$inject = ['$rootScope', '$state'];

export default AppRun;